//
//  ViewController.m
//  FirstProject1
//
//  Created by iD Student on 7/23/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController
@synthesize increaseButton;
@synthesize numberLabel;
@synthesize decreaseButton;

- (void)viewDidLoad
{
    [super viewDidLoad];
	currentValue = 0;
    [numberLabel setText :[NSString stringWithFormat :@"%i",currentValue]];
}

- (void)viewDidUnload
{
    [self setNumberLabel:nil];
    [self setIncreaseButton:nil];
    [self setDecreaseButton:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

- (IBAction)Increase:(id)sender {
    if(currentValue < 11){
        currentValue++;
        [numberLabel setText :[NSString stringWithFormat :@"%i",currentValue]];
    }else{
        [increaseButton setEnabled:false];
    }
    
    if(currentValue > 0){
        [decreaseButton setEnabled:true];
    }
}

- (IBAction)Decrease:(id)sender {
    if(currentValue > 0){
        currentValue--;
        [numberLabel setText :[NSString stringWithFormat :@"%i",currentValue]];
    }else{
        [decreaseButton setEnabled:false];
    }
    if(currentValue < 11){
        [increaseButton setEnabled:true];
    }
}
@end
